Timer 2
Diese Timer-Variante benötigt die Klasse CL_GUI_TIMER. Im Beispielprogramm wird der Timer bei Programmaufruf initialisiert. Drückt der Anwender zehn Sekunden lang keine Taste, so wird das Programm automatisch ausgeführt.
REPORT zz_timer.
*———————————————————————-*
* CLASS lcl_handler DEFINITION
*———————————————————————-*
CLASS lcl_handler DEFINITION.
PUBLIC SECTION.
METHODS: when_done FOR EVENT finished OF cl_gui_timer.
ENDCLASS. “lcl_event_handler DEFINITION
*———————————————————————-*
* CLASS lcl_handler IMPLEMENTATION
*———————————————————————-*
CLASS lcl_handler IMPLEMENTATION.
METHOD when_done.
cl_gui_cfw=>set_new_ok_code( new_code = ‘ONLI’ ). “ONLI = Execute
ENDMETHOD. “when_done
ENDCLASS. “lcl_event_handler IMPLEMENTATION
*** Data
DATA: timer TYPE REF TO cl_gui_timer.
DATA: href TYPE REF TO lcl_handler.
DATA ls_t005t TYPE t005t.
*** Selection-Screen
SELECT-OPTIONS s_land FOR ls_t005t-land1 DEFAULT ‘D*’ OPTION CP.
AT SELECTION-SCREEN OUTPUT.
*** Create the timer as well as the handler
CREATE OBJECT: timer, href.
*** Register event handler
SET HANDLER href->when_done FOR timer.
*** Set value according to your requirement
timer->interval = 10.
*** Start timer
timer->run( ).
START-OF-SELECTION.
*** Stop Timer once list processing begins
timer->cancel( ).
*** Select data
SELECT * FROM t005t INTO ls_t005t
WHERE land1 IN s_land
AND spras = sy-langu.
WRITE:/ ls_t005t-land1, ls_t005t-landx.
ENDSELECT.
- 7. December: Excel Racing Simulation – Root Vole Race - 7. Dezember 2024
- 5. December: ABAPConf - 5. Dezember 2024
- 4. December: Only a lazy developer is a good developer - 4. Dezember 2024